﻿<%@ Assembly Name="$SharePoint.Project.AssemblyFullName$" %>
<%@ Assembly Name="Microsoft.Web.CommandUI, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %>
<%@ Register TagPrefix="SharePoint" Namespace="Microsoft.SharePoint.WebControls"
    Assembly="Microsoft.SharePoint, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %>
<%@ Register TagPrefix="Utilities" Namespace="Microsoft.SharePoint.Utilities" Assembly="Microsoft.SharePoint, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %>
<%@ Register TagPrefix="asp" Namespace="System.Web.UI" Assembly="System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" %>
<%@ Import Namespace="Microsoft.SharePoint" %>
<%@ Register TagPrefix="WebPartPages" Namespace="Microsoft.SharePoint.WebPartPages"
    Assembly="Microsoft.SharePoint, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %>
<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="Leave_Request_DashboardUserControl.ascx.cs"
    Inherits="Trig_AMJ_HR_Forms.Leave_Request_Dashboard.Leave_Request_DashboardUserControl" %>
<link rel="Stylesheet" type="text/css" href="/Style Library/Al Majed/CSS/Trig_HR.css" />
<table cellspacing="0" cellpadding="0">
    <tr runat="server" id="trManager">
        <td class="tdCell">
            User(s)
        </td>
        <td class="tdCell">
            <SharePoint:PeopleEditor runat="server" ID="pplUsers" MultiSelect="true" Width="250px" />
        </td>
        <td>
            <asp:Button runat="server" ID="btnGetLeaveRec" Text="Get Records" OnClick="btnGetLeaveRec_Click"
                CssClass="ms-ButtonHeightWidth" />
        </td>
        <td>
            <asp:Button runat="server" ID="btnClear" Text="Clear Records" OnClick="btnClear_Click"  CssClass="ms-ButtonHeightWidth" />
        </td>

    </tr>
</table>
<table>
    <tr>
        <td colspan="4">
            <asp:GridView ID="gvLeaveDb" runat="server" AllowPaging="True" AutoGenerateColumns="false"
                CssClass="Grid-default"   AlternatingRowStyle-CssClass="alt-tr"
                EnableModelValidation="True" GridLines="Both" PageSize="10"
                OnRowDataBound="gvLeaveDb_RowDataBound">
                <PagerSettings Mode="Numeric" Position="Bottom" Visible="false" />
                <Columns>
                    <asp:TemplateField HeaderText="User" ItemStyle-CssClass="td-left" HeaderStyle-CssClass="td-center">
                        <ItemTemplate>
                            <asp:Label ID="lblSumittedUser" runat="server" Text='<%# Eval("SubmittedFor") %>'></asp:Label>
                        </ItemTemplate>
                    </asp:TemplateField>
                    <asp:TemplateField HeaderText="Reference Number" ItemStyle-CssClass="td-center" HeaderStyle-CssClass="td-center">
                        <ItemTemplate>
                            <asp:Label ID="lblRefNo" runat="server" Text='<%# Eval("Reference_x0020_Number") %>'></asp:Label>
                        </ItemTemplate>
                    </asp:TemplateField>
                    <asp:TemplateField HeaderText="Cancel Leave Request" ItemStyle-CssClass="td-center" Visible="false"
                        HeaderStyle-CssClass="td-center">
                        <ItemTemplate>
                            <asp:HyperLink ID="lnkCancelLeave" runat="server" Text="Cancel" TargetName="_blank"></asp:HyperLink>
                        </ItemTemplate>
                    </asp:TemplateField>

                    <asp:TemplateField HeaderText="Clearance Form" ItemStyle-CssClass="td-center" HeaderStyle-CssClass="td-center"
                        Visible="false">
                        <ItemTemplate>
                            <asp:HiddenField runat="server" ID="hdnClearance" Value='<%# Eval("ClearanceStatus") %>' />
                        </ItemTemplate>
                    </asp:TemplateField>

                    <asp:TemplateField HeaderText="Submit Clearance Form" ItemStyle-CssClass="td-center"
                        HeaderStyle-CssClass="td-center">
                        <ItemTemplate>
                            <asp:HyperLink ID="lnkClearance" runat="server" Text="Submit" TargetName="_blank"></asp:HyperLink>
                        </ItemTemplate>
                    </asp:TemplateField>
                    <asp:TemplateField HeaderText="Undertaking Form" ItemStyle-CssClass="td-center" HeaderStyle-CssClass="td-center"
                        Visible="false">
                        <ItemTemplate>
                            <asp:HiddenField runat="server" ID="hdnUnder" Value='<%# Eval("HandoverStatus") %>' />
                        </ItemTemplate>
                    </asp:TemplateField>
                    <asp:TemplateField HeaderText="Undertaking Form" ItemStyle-CssClass="td-center" HeaderStyle-CssClass="td-center">
                        <ItemTemplate>
                            <asp:LinkButton ID="lnkUndertaking" runat="server" Text="Generate"></asp:LinkButton>
                        </ItemTemplate>
                    </asp:TemplateField>
                    <asp:TemplateField HeaderText="Exit Permit Form" ItemStyle-CssClass="td-center" HeaderStyle-CssClass="td-center"
                        Visible="false">
                        <ItemTemplate>
                            <asp:HiddenField runat="server" ID="hdnExit" Value='<%# Eval("ExitStatus") %>' />
                        </ItemTemplate>
                    </asp:TemplateField>
                    <asp:TemplateField HeaderText="Exit Permit Form" ItemStyle-CssClass="td-center" HeaderStyle-CssClass="td-center">
                        <ItemTemplate>
                            <asp:HyperLink ID="lnkExitPermit" runat="server" Text="Generate" TargetName="_blank"></asp:HyperLink>
                        </ItemTemplate>
                    </asp:TemplateField>
                    <asp:TemplateField HeaderText="Undertaking Form" ItemStyle-CssClass="td-center" HeaderStyle-CssClass="td-center"
                        Visible="false">
                        <ItemTemplate>
                            <asp:HiddenField runat="server" ID="hdnResumption" Value='<%# Eval("ResumptionStatus") %>' />
                        </ItemTemplate>
                    </asp:TemplateField>
                    <asp:TemplateField HeaderText="Resumption of Duty" ItemStyle-CssClass="td-center"
                        HeaderStyle-CssClass="td-center">
                        <ItemTemplate>
                            <asp:HyperLink ID="lnkResumpDuty" runat="server" Text="Click Here" TargetName="_blank"></asp:HyperLink>
                        </ItemTemplate>
                    </asp:TemplateField>
                    <asp:TemplateField HeaderText="Print Leave" ItemStyle-CssClass="td-center" HeaderStyle-CssClass="td-center">
                        <ItemTemplate>
                            <asp:HyperLink ID="lnkPrintLeave" runat="server" Text="Print" TargetName="_blank"></asp:HyperLink>
                        </ItemTemplate>
                    </asp:TemplateField>
                </Columns>
            </asp:GridView>
        </td>
    </tr>
    <tr>
        <td>
            <asp:Label runat="server" ID="lblError" Text=""></asp:Label>
        </td>
    </tr>
</table>
<script language="javascript" type="text/javascript">
    function OpenDialogbox(URL, Height, Width) {
        var dialogOptions = SP.UI.$create_DialogOptions();
        dialogOptions.url = URL; // URL of the Page
        dialogOptions.width = Width; // Width of the Dialog
        dialogOptions.height = Height; // Height of the Dialog
        dialogOptions.allowMaximize = false;
        dialogOptions.dialogReturnValueCallback = Function.createDelegate(null, CloseCallback); // Function to capture dialog closed event
        SP.UI.ModalDialog.showModalDialog(dialogOptions); // Open the Dialog
        return false;
    }
    function CloseCallback(strReturnValue, result, target) {
        if (strReturnValue === SP.UI.DialogResult.OK) // Perform action on Ok.
        {
            // Refresh page after user closed the alert window
            window.location.href = window.location.href;
        }

    }
</script>
